<?php 
 	if (($format == 2) || ($format == 3)) {
		header("Pragma: public");
		header("Expires: 0");
		header("Accept-Ranges: bytes");
		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
		if ($format == 2) {
			header("Content-Type: application/vnd.ms-word");
			header('Content-Disposition: attachment; filename=spisok.doc');
		} 
		if ($format == 3){
			header("Content-Type: application/vnd.ms-excel");
			header('Content-Disposition: attachment; filename=spisok.xls');			
		}
		header("Content-Transfer-Encoding: binary");
	}
?>
<div class="students index">
<?php // __('<h2>Список студентов</h2>');?>
<table cellpadding="0" cellspacing="0" class="art-article">
<tr>
	<th>№п/п</th>
	<th>ID</th>
	<th>Фамилия</th>
	<th>Имя</th>
	<th>Отчество</th>	
	<th>Факультет</th>
	<th>Специальность</th>
	<th>Курс</th>
	<th>группа</th>	
	<th>Форма обуч.</th>
	<th>Тип обуч.</th>
	<th>Состояние</th>


	<th class="actions"><?php __('Действия');?></th>

</tr>
<?php
$i = 0;
foreach ($students as $student):
$i++;
?>
	<tr>
		<td> 
			<?php echo $i; ?>
		</td>
		<td>
			<?php echo $student['Student']['id']; ?>
		</td>
		<td>
			<?php echo $student['Student']['lastname']; ?>
		</td>
		<td>
			<?php echo $student['Student']['firstname']; ?>
		</td>
		<td>
			<?php echo $student['Student']['surname']; ?>
		</td>		
		<td>
			<?php echo $facultets[$courses[$student['Studentgroup']['course_id']-1]['Profession']['facultet_id']]; ?>
		</td>
		<td>
			<?php echo $courses[$student['Studentgroup']['course_id']-1]['Profession']['name']; ?>
		</td>
		<td>
			<?php echo $courses[$student['Studentgroup']['course_id']-1]['Course']['name']; ?>
		</td>
		<td>
			<?php echo $student['Studentgroup']['name']; ?>
		</td>				
		<td>
			<?php echo $learningforms[$student['Student']['learningform_id']]; ?>
		</td>
		<td>
			<?php echo $learningtypes[$student['Student']['learningtype_id']]; ?>
		</td>

		<td>
			<?php echo $student['Studentstate']['name']; ?>
		</td>

		<!--
		<td>
			<?php echo $student['Student']['unic_number']; ?>
		</td>
		-->
		<td class="actions">
			<?php  
					if ($format == 1){
						echo $html->link(__('Подробнее', true), array('controller' => 'studentinfos', 'action' => 'showinfo', $student['Student']['id']));
					}
					?>			
		</td>
	</tr>
<?php endforeach; ?>
</table>
</div>